package com.ruoyi.project.remake.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.remake.domain.RemakeCaseDetailsThrid;
import com.ruoyi.project.remake.service.IRemakeCaseDetailsThridService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 今创病例基本信息Controller
 *
 * @author 孙山伟
 * @date 2023-05-27
 */
@RestController
@RequestMapping("/remake/thridDetails")
public class RemakeCaseDetailsThridController extends BaseController
{
    @Autowired
    private IRemakeCaseDetailsThridService remakeCaseDetailsThridService;

    /**
     * 查询今创病例基本信息列表
     */
    @PreAuthorize("@ss.hasPermi('remake:thrid:list')")
    @GetMapping("/list")
    public TableDataInfo list(RemakeCaseDetailsThrid remakeCaseDetailsThrid)
    {
        startPage();
        List<RemakeCaseDetailsThrid> list = remakeCaseDetailsThridService.selectRemakeCaseDetailsThridList(remakeCaseDetailsThrid);
        return getDataTable(list);
    }

    /**
     * 导出今创病例基本信息列表
     */
    @PreAuthorize("@ss.hasPermi('remake:thrid:export')")
    @Log(title = "今创病例基本信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(RemakeCaseDetailsThrid remakeCaseDetailsThrid)
    {
        List<RemakeCaseDetailsThrid> list = remakeCaseDetailsThridService.selectRemakeCaseDetailsThridList(remakeCaseDetailsThrid);
        ExcelUtil<RemakeCaseDetailsThrid> util = new ExcelUtil<RemakeCaseDetailsThrid>(RemakeCaseDetailsThrid.class);
        return util.exportExcel(list, "thrid");
    }

    /**
     * 获取今创病例基本信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('remake:thrid:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(remakeCaseDetailsThridService.selectRemakeCaseDetailsThridById(id));
    }

    /**
     * 新增今创病例基本信息
     */
    @PreAuthorize("@ss.hasPermi('remake:thrid:add')")
    @Log(title = "今创病例基本信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RemakeCaseDetailsThrid remakeCaseDetailsThrid)
    {
        return toAjax(remakeCaseDetailsThridService.insertRemakeCaseDetailsThrid(remakeCaseDetailsThrid));
    }

    /**
     * 修改今创病例基本信息
     */
    @PreAuthorize("@ss.hasPermi('remake:thrid:edit')")
    @Log(title = "今创病例基本信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RemakeCaseDetailsThrid remakeCaseDetailsThrid)
    {
        return toAjax(remakeCaseDetailsThridService.updateRemakeCaseDetailsThrid(remakeCaseDetailsThrid));
    }

    /**
     * 删除今创病例基本信息
     */
    @PreAuthorize("@ss.hasPermi('remake:thrid:remove')")
    @Log(title = "今创病例基本信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(remakeCaseDetailsThridService.deleteRemakeCaseDetailsThridByIds(ids));
    }
}
